<script>
    //箭头函数:删除关键字function，在()和{}之间添加'=>'

    //es5
    const sum1 = function (a, b) {
        return a + b;
    }
    console.log(sum1(1, 1));

    //es6
    const sum2 = (a, b) => {
        return a + b;
    }
    console.log(sum2(1, 2));

    //注意：当函数代码块内，只有一行代码或是return操作，可直接删除{}和return
    const sum3 = (a, b) => a + b;
    console.log(sum3(1, 3));

    const obj = {
        a: 1,
        b: 2,
        c: () => console.log('c'),
    };
    obj.c();



</script>